<#import "../tpl/pageTep.ftl" as page>
<@page.pageBase currentMenu="补卡列表">
<style>
    .form-horizontal .controls {
        line-height: 40px;
        height: 40px;
    }

    .button-primary, .button-success, .button-danger {
        margin-left: 5px;
    }
</style>
<form id="searchForm" class="form-panel">
    <ul class="panel-content">
        <li>
            <div class="control-group span5">
                <div class="controls">
                    <input type="text" name="title" id="title" value="" placeholder="输入关键字">
                </div>
            </div>
            <div class="form-actions span8">
                <button type="submit" class="button  button-primary">
                    搜索
                </button>
            </div>
        </li>
    </ul>
</form>
<div id="grid"></div>
<script>
    var Grid = BUI.Grid,
            Store = BUI.Data.Store,
            columns = [
                {title: 'ID', dataIndex: 'rid', width: '10%',elCls: 'center'},
                {title: '活动名称', dataIndex: 'offlineName', width: '20%',elCls: 'center'},
                {title: '补卡人', dataIndex: 'applicantName', width: "20%",elCls: 'center'},
                {title: '补卡类型', dataIndex: 'signType', width: "10%",elCls: 'center',renderer:function(data){
                        if(data=='in'){
                            return '签到补卡';
                        }else{
                            return '签退补卡'
                        }
                }},
                {title: '补卡时间', dataIndex: 'applyTime', width: "20%",elCls: 'center'},
                {
                    title: '审批状态', dataIndex: 'status',elCls: 'center',width: "10%", renderer: function (data) {
                    if (data == "init") {
                        return '待审核';
                    } else if(data=="pass") {
                        return '已通过';
                    }else if (data=='fail'){
                        return'不通过'
                    }else
                        return '已失效'
                }
                },
                {
                    title: '操作', dataIndex: 'rid',elCls: 'center', width: "10%", renderer: function (value,obj) {
                    if(obj.status=='init')
                        return '<a href="${basepath}/manage/retroactive/toEdit?id=' + value + '">审核</a>';
                    else
                        return '<a href="${basepath}/manage/retroactive/toView?id=' + value + '">查看</a>';

                }
                }
            ];
    var store = new Store({
                url: 'list',
                autoLoad: true, //自动加载数据
                params: { //配置初始请求的参数
                    length: '10'
                },
                pageSize: 10,	// 配置分页数目
                root: 'list',//统一格式
                totalProperty: 'total'//统一格式
            }),
            grid = new Grid.Grid({
                render: '#grid',
                columns: columns,
                loadMask: true, //加载数据时显示屏蔽层
                store: store,
                plugins: [Grid.Plugins.CheckSelection], // 插件形式引入多选表格

                // 底部工具栏
                bbar: {
                    pagingBar: true
                }
            });
    grid.render();//渲染

    var form = new BUI.Form.HForm({
        srcNode: '#searchForm'
    }).render();

    form.on('beforesubmit', function (ev) {
        //序列化成对象
        var obj = form.serializeToObject();
        obj.start = 0; //返回第一页
        store.load(obj);
        return false;
    });
</script>
</@page.pageBase>